package router

import (
	"github.com/gin-gonic/gin"
	"shop-security/preAuthorize"
	"shop-sys/controller"
)

func PrivateSysMenu(router *gin.RouterGroup) {
	api := &controller.SysMenuController{}
	sysMenuRouter := router.Group("/sys/menu")
	{
		sysMenuRouter.GET("/nav", api.Nav)                                                          //获取用户所拥有的菜单和权限
		sysMenuRouter.GET("/table", api.Table)                                                      //获取菜单页面的表
		sysMenuRouter.GET("/list", api.List)                                                        //所有菜单列表(用于新建、修改角色时 获取菜单的信息)
		sysMenuRouter.GET("/listRootMenu", api.ListRootMenu)                                        //选择菜单
		sysMenuRouter.GET("/listChildrenMenu", api.ListChildrenMenu)                                //选择子菜单
		sysMenuRouter.GET("/info/:menuId", preAuthorize.HasPermission("sys:menu:info"), api.Info)   //菜单信息
		sysMenuRouter.POST("", preAuthorize.HasPermission("sys:menu:save"), api.Save)               //保存菜单
		sysMenuRouter.PUT("", preAuthorize.HasPermission("sys:menu:update"), api.Update)            //修改菜单
		sysMenuRouter.DELETE("/:menuId", preAuthorize.HasPermission("sys:menu:delete"), api.Delete) //删除菜单
	}
}
